package com.hanbang.chu_xing_gao_zhao.view_me;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebSettings;
import android.webkit.WebView;

import com.hanbang.chu_xing_gao_zhao.application.HttpInterfaces;
import com.hanbang.chu_xing_gao_zhao.base.BaseActivity;
import com.hanbang.chu_xing_gao_zhao.utils.MyLog;
import com.hanbang.cxgz_2.R;

/**
 * 关于厨星高灶
 */
public class MeAboutActivity extends BaseActivity {

    private WebView content;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.me_about);
        initView();
        setOnClickListener();
    }

    /**
     * 初始化view
     */
    private void initView() {
        setTitleMore(View.VISIBLE, View.INVISIBLE, "关于厨星高灶", null, null, null);
        setBackArrows(findViewById(R.id.bar_top_conver_classify_back));
        content = (WebView) findViewById(R.id.wv_me_webview);
        configWebview();

    }

    /**
     * 设置点击事件
     */
    private void setOnClickListener() {
        content.loadUrl(HttpInterfaces.WEB_POST + "id=" + 105);
    }

    /**
     * 处理监听
     */
    @SuppressWarnings("unused")
    private OnClickListener onClickListener = new OnClickListener() {

        @Override
        public void onClick(View v) {
            switch (v.getId()) {

                default:
                    break;
            }
        }
    };

    @Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
    }

    @Override
    protected void onPause() {
        // TODO Auto-generated method stub
        super.onPause();
    }

    @Override
    protected void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
    }


    /**
     * 重新设置webview 属性
     */

    @SuppressWarnings("unused")
    private void configWebview() {
        // 设置文本编码
        content.getSettings().setDefaultTextEncodingName("utf-8");
        // 可以缩放
        content.getSettings().setSupportZoom(true);
        content.getSettings().setJavaScriptEnabled(true);
        content.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
        content.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        // 开启 Application Caches 功能
        content.getSettings().setAppCacheEnabled(false);
        content.getSettings().setLoadWithOverviewMode(true);
        // webView.getSettings().setDefaultZoom(ZoomDensity.MEDIUM);// 默认缩放模式
        content.getSettings().setUseWideViewPort(false);
    }


    /**
     * 更新地址
     *
     * @return
     */
    private String getFont() {
        StringBuilder builder = new StringBuilder();
        // <body class="MsoNormal"> </body>
        builder.append(".Likun { font-family: fzlt;}");
        builder.append("@font-face {font-family:fzlt;");
        builder.append("src:url(file:///android_asset/fzlt.ttf);}");
        return builder.toString();
    }
}
